package com.gitee.wsl.doc.sample.opml

import com.gitee.wsl.doc.xml.XmlPullParser


/**
 * Handling strategy for specific sections of an OPML document. Implementations should be assumed not-threadsafe unless
 * explicitly documented otherwise.
 */
internal interface OpmlSectionHandler<E> {
    /**
     * Handle [XmlPullParser.START_TAG] event. The [XmlPullParser] should not be moved by this method.
     *
     * @param xpp
     * an [XmlPullParser] instance, set at [XmlPullParser.START_TAG]
     * @throws com.gitee.wsl.doc.sample.opml.OpmlParseException
     */
    @Throws(_root_ide_package_.com.gitee.wsl.doc.sample.opml.OpmlParseException::class)
    fun startTag(xpp: XmlPullParser)

    /**
     * Handle [XmlPullParser.TEXT] event. The [XmlPullParser] should not be moved by this method.
     *
     * @param xpp
     * an [XmlPullParser] instance, set at [XmlPullParser.TEXT]
     * @throws com.gitee.wsl.doc.sample.opml.OpmlParseException
     */
    @Throws(_root_ide_package_.com.gitee.wsl.doc.sample.opml.OpmlParseException::class)
    fun text(xpp: XmlPullParser)

    /**
     * Handle [XmlPullParser.END_TAG] event. The [XmlPullParser] should not be moved by this method.
     *
     * @param xpp
     * an [XmlPullParser] instance, set at [XmlPullParser.END_TAG]
     * @throws com.gitee.wsl.doc.sample.opml.OpmlParseException
     */
    @Throws(_root_ide_package_.com.gitee.wsl.doc.sample.opml.OpmlParseException::class)
    fun endTag(xpp: XmlPullParser)

    fun get(): E
}


/**
 * An exception indicating an unrecoverable issue during parsing an OPML document
 */
class OpmlParseException : Exception {
    constructor(cause: Throwable?) : super(cause)

    constructor(message: String?) : super(message)

}
